﻿using Microsoft.Xna.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TacticalGridWars
{
    /// <summary>
    /// A character that exists on the gameboard and is controllable by the player
    /// </summary>
    public class Soldier
    {
        #region MemberData
        private int x = 0;
        private int y = 0;
        private bool attackable; 
        #endregion

        #region Properties
        public int Moves { get; set; }

        public bool Dead { get; set; }

        public double HitChance { get; set; }

        public bool Attackable 
        {
            get { return attackable && !Dead; }
            set { attackable = value; } 
        }

        public int XPos
        {
            get { return x; }
            set
            {
                x = value;
            }
        }
        public int YPos
        {
            get { return y; }
            set
            {
                y = value;
            }
        }
        public bool Selected { get; set; }
        #endregion

        public Soldier()
        {
            Moves = 2;
            Selected = false;
            Attackable = false;
            Dead = false;
            HitChance = 0;
        }

        public Soldier(Grid.Spawn spawn, int moves = 2)
        {
            x = spawn.YPos;
            y = spawn.XPos;
            Selected = false;
            Attackable = false;
            Dead = false;
            Moves = moves;
            HitChance = 0;
        }

        public void SetPosition(int x, int y)
        {
            XPos = x;
            YPos = y;
        }
    }
}
